package com.suriya.thirukural;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
import android.content.Context;
import android.content.Intent;

public class ThirukuralWidget extends AppWidgetProvider
{
    @Override
    public void onDeleted(Context context, int[] appWidgetIds)
    {
        super.onDeleted(context, appWidgetIds);

        Intent serviceIntent = new Intent(context, KuralWidgetService.class);
        serviceIntent.putExtra("command", "deleteWidgetIds");
        serviceIntent.putExtra("ids", appWidgetIds);
        context.startService(serviceIntent);
    }

    @Override
    public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds)
    {
        super.onUpdate(context, appWidgetManager, appWidgetIds);
        Intent serviceIntent = new Intent(context, KuralWidgetService.class);
        serviceIntent.putExtra("command", "updateWidgets");
        serviceIntent.putExtra("ids", appWidgetIds);
        serviceIntent.putExtra("type", "MainScreen");
        context.startService(serviceIntent);
    }
}
